package com.atguigu.lease.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
//@Data 给class自动添加get和set方法(lombok依赖)
//@Schema 给knife4j的接口文档配置响应参数的描述(knife4j依赖)
//@TableField(value = 数据库字段名, fill = 何时填充) (mybatisplus依赖)
//JsonIgnore 配置该注解，查询结果就不会显示该字段
//@TableLogic 逻辑删除 [配置该注解查询时会过滤掉is_deleted=1](mybatisplus依赖)
public class BaseEntity implements Serializable {

    @Schema(description = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "创建时间")
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    @JsonIgnore//配置该注解，查询结果就不会显示该字段
    private Date createTime;

    @Schema(description = "更新时间")
    @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
    @JsonIgnore
    private Date updateTime;

    @Schema(description = "逻辑删除")
    @JsonIgnore
    //@TableLogic //逻辑删除 [配置该注解查询时会过滤掉is_deleted=1]
    //和yml配置文件的logic-delete-field: isDeleted
    @TableField("is_deleted")
    private Byte isDeleted;

}